package edu.upf.da.p2p.sm.server;

import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.ThreadFilter;

import edu.upf.da.p2p.sm.client.message.SearchRequest;
import edu.upf.da.p2p.sm.server.manager.SearchRequestManager;
import edu.upf.da.p2p.sm.server.manager.UserStatusManager;

/**
 * Esta es la implementacion de servidor para autorizaciones.
 * @author Grupo A.
 */
public class SearchServer extends P2PGenericServer{

	private SearchRequestManager searchRequestManager;

	public SearchServer() {
		super("search");
		searchRequestManager = new SearchRequestManager(this);
	}

	public SearchServer(UserStatusManager mapper) {
		super("search",mapper);
	}

	protected void setListeners() {
		PacketFilter filterf = new ThreadFilter(SearchRequest.class.getCanonicalName());
		con.createPacketCollector(filterf);
		con.addPacketListener(searchRequestManager, filterf);
	}

	public SearchRequestManager getSearchRequestManager(){
		return searchRequestManager;
	}

}
